3.11.73 \(\int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx\) [1073]

Optimal. Leaf size=78 \[ a (c-i d)^2 x-\frac {i a (c-i d)^2 \log (\cos (e+f x))}{f}+\frac {a d (i c+d) \tan (e+f x)}{f}+\frac {i a (c+d \tan (e+f x))^2}{2 f} \]

[Out]

a*(c-I*d)^2*x-I*a*(c-I*d)^2*ln(cos(f*x+e))/f+a*d*(I*c+d)*tan(f*x+e)/f+1/2*I*a*(c+d*tan(f*x+e))^2/f

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {3609, 3606, 3556} \begin {gather*} \frac {i a (c+d \tan (e+f x))^2}{2 f}+\frac {a d (d+i c) \tan (e+f x)}{f}-\frac {i a (c-i d)^2 \log (\cos (e+f x))}{f}+a x (c-i d)^2 \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x])^2,x]

[Out]

a*(c - I*d)^2*x - (I*a*(c - I*d)^2*Log[Cos[e + f*x]])/f + (a*d*(I*c + d)*Tan[e + f*x])/f + ((I/2)*a*(c + d*Tan
[e + f*x])^2)/f

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx &=\frac {i a (c+d \tan (e+f x))^2}{2 f}+\int (c+d \tan (e+f x)) (a (c-i d)+a (i c+d) \tan (e+f x)) \, dx\\ &=a (c-i d)^2 x+\frac {a d (i c+d) \tan (e+f x)}{f}+\frac {i a (c+d \tan (e+f x))^2}{2 f}+\left (i a (c-i d)^2\right ) \int \tan (e+f x) \, dx\\ &=a (c-i d)^2 x-\frac {i a (c-i d)^2 \log (\cos (e+f x))}{f}+\frac {a d (i c+d) \tan (e+f x)}{f}+\frac {i a (c+d \tan (e+f x))^2}{2 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(175\) vs. \(2(78)=156\).
time = 1.48, size = 175, normalized size = 2.24 \begin {gather*} \frac {(\cos (f x)-i \sin (f x)) \left (4 (c-i d)^2 f x \cos (e+f x) (\cos (e)-i \sin (e))-2 (c-i d)^2 \text {ArcTan}(\tan (2 e+f x)) \cos (e+f x) (\cos (e)-i \sin (e))-i (c-i d)^2 \cos (e+f x) \log \left (\cos ^2(e+f x)\right ) (\cos (e)-i \sin (e))+d^2 \sec (e+f x) (i \cos (e)+\sin (e))+2 (2 c-i d) d \sin (f x) (i+\tan (e))\right ) (a+i a \tan (e+f x))}{2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x])^2,x]

[Out]

((Cos[f*x] - I*Sin[f*x])*(4*(c - I*d)^2*f*x*Cos[e + f*x]*(Cos[e] - I*Sin[e]) - 2*(c - I*d)^2*ArcTan[Tan[2*e +
f*x]]*Cos[e + f*x]*(Cos[e] - I*Sin[e]) - I*(c - I*d)^2*Cos[e + f*x]*Log[Cos[e + f*x]^2]*(Cos[e] - I*Sin[e]) +
d^2*Sec[e + f*x]*(I*Cos[e] + Sin[e]) + 2*(2*c - I*d)*d*Sin[f*x]*(I + Tan[e]))*(a + I*a*Tan[e + f*x]))/(2*f)

________________________________________________________________________________________

Maple [A]
time = 0.11, size = 94, normalized size = 1.21

method result size
derivativedivides \(\frac {a \left (\frac {i d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+2 i c d \tan \left (f x +e \right )+d^{2} \tan \left (f x +e \right )+\frac {\left (i c^{2}-i d^{2}+2 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-2 i c d +c^{2}-d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(94\)
default \(\frac {a \left (\frac {i d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+2 i c d \tan \left (f x +e \right )+d^{2} \tan \left (f x +e \right )+\frac {\left (i c^{2}-i d^{2}+2 c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (-2 i c d +c^{2}-d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(94\)
norman \(\left (-2 i a c d +a \,c^{2}-a \,d^{2}\right ) x +\frac {\left (2 i a c d +a \,d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {i a \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {i a \left (-2 i c d +c^{2}-d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) \(94\)
risch \(\frac {4 i a c d e}{f}-\frac {2 a \,c^{2} e}{f}+\frac {2 a \,d^{2} e}{f}-\frac {2 a d \left (-2 i {\mathrm e}^{2 i \left (f x +e \right )} d +2 \,{\mathrm e}^{2 i \left (f x +e \right )} c -i d +2 c \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}-\frac {2 a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c d}{f}-\frac {i a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2}}{f}+\frac {i a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{2}}{f}\) \(149\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f*a*(1/2*I*d^2*tan(f*x+e)^2+2*I*c*d*tan(f*x+e)+d^2*tan(f*x+e)+1/2*(-I*d^2+I*c^2+2*c*d)*ln(1+tan(f*x+e)^2)+(-
2*I*c*d+c^2-d^2)*arctan(tan(f*x+e)))

________________________________________________________________________________________

Maxima [A]
time = 0.51, size = 98, normalized size = 1.26 \begin {gather*} -\frac {-i \, a d^{2} \tan \left (f x + e\right )^{2} - 2 \, {\left (a c^{2} - 2 i \, a c d - a d^{2}\right )} {\left (f x + e\right )} + {\left (-i \, a c^{2} - 2 \, a c d + i \, a d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \, {\left (-2 i \, a c d - a d^{2}\right )} \tan \left (f x + e\right )}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

-1/2*(-I*a*d^2*tan(f*x + e)^2 - 2*(a*c^2 - 2*I*a*c*d - a*d^2)*(f*x + e) + (-I*a*c^2 - 2*a*c*d + I*a*d^2)*log(t
an(f*x + e)^2 + 1) + 2*(-2*I*a*c*d - a*d^2)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 158 vs. \(2 (69) = 138\).
time = 1.09, size = 158, normalized size = 2.03 \begin {gather*} -\frac {4 \, a c d - 2 i \, a d^{2} + 4 \, {\left (a c d - i \, a d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - {\left (-i \, a c^{2} - 2 \, a c d + i \, a d^{2} + {\left (-i \, a c^{2} - 2 \, a c d + i \, a d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} - 2 \, {\left (i \, a c^{2} + 2 \, a c d - i \, a d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

-(4*a*c*d - 2*I*a*d^2 + 4*(a*c*d - I*a*d^2)*e^(2*I*f*x + 2*I*e) - (-I*a*c^2 - 2*a*c*d + I*a*d^2 + (-I*a*c^2 -
2*a*c*d + I*a*d^2)*e^(4*I*f*x + 4*I*e) - 2*(I*a*c^2 + 2*a*c*d - I*a*d^2)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x +
 2*I*e) + 1))/(f*e^(4*I*f*x + 4*I*e) + 2*f*e^(2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Sympy [A]
time = 0.36, size = 119, normalized size = 1.53 \begin {gather*} - \frac {i a \left (c - i d\right )^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 4 a c d + 2 i a d^{2} + \left (- 4 a c d e^{2 i e} + 4 i a d^{2} e^{2 i e}\right ) e^{2 i f x}}{f e^{4 i e} e^{4 i f x} + 2 f e^{2 i e} e^{2 i f x} + f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))**2,x)

[Out]

-I*a*(c - I*d)**2*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-4*a*c*d + 2*I*a*d**2 + (-4*a*c*d*exp(2*I*e) + 4*I*a*d*
*2*exp(2*I*e))*exp(2*I*f*x))/(f*exp(4*I*e)*exp(4*I*f*x) + 2*f*exp(2*I*e)*exp(2*I*f*x) + f)

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 301 vs. \(2 (69) = 138\).
time = 0.56, size = 301, normalized size = 3.86 \begin {gather*} \frac {-i \, a c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 \, a c d e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, a d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 i \, a c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 4 \, a c d e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 2 i \, a d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 4 \, a c d e^{\left (2 i \, f x + 2 i \, e\right )} + 4 i \, a d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - i \, a c^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 2 \, a c d \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + i \, a d^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - 4 \, a c d + 2 i \, a d^{2}}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

(-I*a*c^2*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 2*a*c*d*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*
e) + 1) + I*a*d^2*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - 2*I*a*c^2*e^(2*I*f*x + 2*I*e)*log(e^(2*I*
f*x + 2*I*e) + 1) - 4*a*c*d*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 2*I*a*d^2*e^(2*I*f*x + 2*I*e)*l
og(e^(2*I*f*x + 2*I*e) + 1) - 4*a*c*d*e^(2*I*f*x + 2*I*e) + 4*I*a*d^2*e^(2*I*f*x + 2*I*e) - I*a*c^2*log(e^(2*I
*f*x + 2*I*e) + 1) - 2*a*c*d*log(e^(2*I*f*x + 2*I*e) + 1) + I*a*d^2*log(e^(2*I*f*x + 2*I*e) + 1) - 4*a*c*d + 2
*I*a*d^2)/(f*e^(4*I*f*x + 4*I*e) + 2*f*e^(2*I*f*x + 2*I*e) + f)

________________________________________________________________________________________

Mupad [B]
time = 5.11, size = 75, normalized size = 0.96 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a\,d^2+2{}\mathrm {i}\,a\,c\,d\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (1{}\mathrm {i}\,a\,c^2+2\,a\,c\,d-1{}\mathrm {i}\,a\,d^2\right )}{f}+\frac {a\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}}{2\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(e + f*x)*1i)*(c + d*tan(e + f*x))^2,x)

[Out]

(tan(e + f*x)*(a*d^2 + a*c*d*2i))/f + (log(tan(e + f*x) + 1i)*(a*c^2*1i - a*d^2*1i + 2*a*c*d))/f + (a*d^2*tan(
e + f*x)^2*1i)/(2*f)

________________________________________________________________________________________